﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using ZedGraph;



namespace ConsoleApplication2
{
    class graph
    {
        public graph(List<Perf> plist)
        {
            GraphPane myPane = new GraphPane(new RectangleF(0, 0, 1280, 1024), "Statistiques des agents", "Nb tours", "");
            //List<PointPairList> pplist = new List<PointPairList>();
            PointPairList pplistvie = new PointPairList();
            PointPairList pplistkill = new PointPairList();
            PointPairList pplistrun = new PointPairList();
            PointPairList pplistHurt = new PointPairList();

            for (int i = 0; i < plist.Count; i++)
            {
                pplistvie.Add(new PointPair((double)i, (double)plist[i]._lifeTime));
                pplistkill.Add(new PointPair((double)i, (double)plist[i]._NbMobKill));
                pplistrun.Add(new PointPair((double)i, (double)plist[i]._Nbrun));
                pplistHurt.Add(new PointPair((double)i, (double)(plist[i]._lifeTime - plist[i]._Nbrun - plist[i]._NbMobKill)));
            }

            myPane.AddCurve("Duree de vie", pplistvie, Color.Blue, SymbolType.Default);
            myPane.AddCurve("Nb Kill", pplistkill, Color.Green, SymbolType.Default);
            myPane.AddCurve("Nb Run", pplistrun, Color.Red, SymbolType.Default);
            myPane.AddCurve("Nb Hurt", pplistHurt, Color.Black, SymbolType.Default);

            Bitmap bm = new Bitmap(10, 10);
            Graphics g = Graphics.FromImage(bm);
            myPane.AxisChange(g);

            Image im = myPane.GetImage();

            im.Save(@"ZGImage.png", ImageFormat.Png);
        }
    }
}
